const gulp = require("gulp");
const browserify = require("browserify");
const fs = require("fs");
const sequence = require("run-sequence");
const watchify = require("watchify");


gulp.task("default",()=>{
    sequence("mainjs");
});


gulp.task("mainjs", () => {

    var b = browserify({
        entries: ["assets/js/index.js"],
        cache: {},
        packageCache: {},
        plugin: [watchify]
    });
    const bundle = function () {
        b.bundle().pipe(fs.createWriteStream("assets/build/main.js"));
    }
    b.on("update", bundle);
    bundle();
});
